/*
  将下面异步代码使用 Promise 的方法改进
  尽量用看上去像同步代码的方式
  setTimeout(function () {
    var a = 'hello'
    setTimeout(function () {
      var b = 'lagou'
      setTimeout(function () {
        var c = 'I ♥ U'
        console.log(a + b +c)
      }, 10)
    }, 10)
  }, 10)
*/

function waitAndPost(time,value){
  return new Promise((resolve,reject)=>{
    setTimeout(()=>{
      resolve(value)
    },time)
  })
}

waitAndPost(10)
  .then(v=>{
    let a="hello"
    return waitAndPost(10,a)
  }).then(v=>{
    let b="lagou"
    return waitAndPost(10,v+b)
  }).then(v=>{
    let c="I ♥ U"
    console.log(v+c)
  })